<!--<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<title>车协官网后台管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">

		<link rel="stylesheet" href="/admin/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="/admin/css/global.css" media="all">
		<link rel="stylesheet" href="/admin/plugins/font-awesome/css/font-awesome.min.css">

	</head>

	<body>
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header header header-demo">
				<div class="layui-main">
					<div class="admin-login-box">
						<a class="logo" style="left: 0;" href="http://beginner.zhengjinfan.cn/demo/beginner_admin/">
							<span style="font-size: 22px;">后台管理</span>
						</a>
						<div class="admin-side-toggle">
							<i class="fa fa-bars" aria-hidden="true"></i>
						</div>
					</div>
					<ul class="layui-nav admin-header-item">
						<li class="layui-nav-item">
							<span>欢迎您<%=host%>:</span>
						</li>
						<li class="layui-nav-item">
							<a href="/" target="_blank">浏览网站</a>
						</li>
						<li class="layui-nav-item" >
							<a href="/logout"><i class="fa fa-sign-out"></i> 注销</a>
						</li>

					</ul>

				</div>
			</div>
			<div class="layui-side layui-bg-black" id="admin-side">
				<div class="layui-side-scroll" id="admin-navbar-side" lay-filter="side"></div>
			</div>
			<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;" id="admin-body">
				<div class="layui-tab admin-nav-card layui-tab-brief" lay-filter="admin-tab">
					<ul class="layui-tab-title">
						<li class="layui-this">
							<i class="fa fa-dashboard" aria-hidden="true"></i>
							<cite>主页</cite>
						</li>
					</ul>-->
					<%include common/include_header.html%>
					<div class="layui-tab-content" style="min-height: 150px; padding: 5px 0 0 0;">
						<div>
							<div style="margin: 15px;">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>编辑企业信息</legend>
		</fieldset>

		<form class="layui-form" action="">

			<div class="layui-form-item">
				<label class="layui-form-label">标题</label>
				<div class="layui-input-block">
					<input type="radio" name="category" value="company_profile" title="企业简介" checked="">
          <input type="radio" name="category" value="qualification" title="资质认证">
          <input type="radio" name="category" value="development_path" title="发展历程">
          <input type="radio" name="category" value="organization" title="组织机构">
          <input type="radio" name="category" value="leaders_speech" title="董事长致辞">
          <input type="radio" name="category" value="application_notes" title="应聘须知">
          <input type="radio" name="category" value="employing_concept" title="用人理念">
				</div>
			</div>


			
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">编辑内容</label>
				<div class="layui-input-block">
					<script id="editor" type="text/plain" style="width:1024px;height:800px;"></script>
					<!--<textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>-->
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" id="add">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</div>
						</div>
					</div>
			<%include common/include_footer.html%>
			<!--<div class="layui-footer footer footer-demo" id="admin-footer">
				<div class="layui-main">
					<p>2018 &copy;
						<a href="/">惠升后台管理系统</a> LGPL license
					</p>
				</div>
			</div>
			<div class="site-tree-mobile layui-hide">
				<i class="layui-icon">&#xe602;</i>
			</div>-->

			<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
			<script type="text/javascript" src="/admin/plugins/layui/layui.js"></script>
			<!--<script type="text/javascript" src="/admin/datas/nav.js"></script>-->
			<script src="/admin/js/index1.js"></script>
			<script>
				layui.use(['form', 'laydate','upload'], function() {
			var form = layui.form(),
					layer = layui.layer,
					laydate = layui.laydate,
					$= layui.jquery;
			var ue = UE.getEditor('editor');
			ue.ready(function() {
			    //设置编辑器的内容
			    ue.execCommand('insertHtml', htmlspecialchars_decode("<%=data.content%>"));
			});
  function htmlspecialchars_decode(str){           
              str = str.replace(/&amp;/g, '&'); 
              str = str.replace(/&lt;/g, '<');
              str = str.replace(/&gt;/g, '>');
              str = str.replace(/&quot;/g, "''");  
              str = str.replace(/&#039;/g, "'");  
              str = str.replace(/&#34;/g, '"'); 
              return str;  
    }
			$("#title").val("<%=data.title%>");
			var mCategory="<%=data.category%>";
			switch(mCategory){
				case "company_profile":
				$(".layui-form-radio").eq(0).trigger("click");
				break;
				case "qualification":$(".layui-form-radio").eq(1).trigger("click");
				break;
				case "development_path":$(".layui-form-radio").eq(2).trigger("click");break;
				case "organization":$(".layui-form-radio").eq(3).trigger("click");break;
				case "leaders_speech":$(".layui-form-radio").eq(4).trigger("click");break;
				case "application_notes":$(".layui-form-radio").eq(5).trigger("click");break;
				case "employing_concept":$(".layui-form-radio").eq(6).trigger("click");break;
			}
			
			//监听提交
			//点击添加分类
			$('#add').on('click', function() {
				var title=$('input:radio:checked').attr('title')
				var from=$("#from").val();
				//获取选中的radio的内容
				var category=$('input:radio:checked').val();
				//获取多文本编辑内容
				var content=UE.getEditor('editor').getContent();
				//测试用户是否录入信息
				if(title==""){
					layer.alert('请填入相关信息');
					return false;
				}
				var id="<%=id%>".toString();
				$.post("/admin/edit_company_information",{_id:id,title:title,category:category,content:content},function(result){
					if(result.status==="success"){
						layer.alert('修改成功,请在新闻列表查看。', {icon: 1} ,function(){
							location.href="/admin/news_list";
						});
						return false;
					}else{
						layer.alert('修改失败', {icon: 2});
						return false;
					}
				});
				//这句话的意思不会刷新当前页面。避免清空内容
				return false;
			});
		});			</script>
		</div>
	</body>

</html>